
// import TableList from "@components/templates/tablelist";
import TableList from "@components/templates/customtablelist";
import { HttpAMRechargeList } from '@/service/api/views';
import { mapState,mapGetters } from "vuex";
export default {
    props:['totalid'],
    mixins: [TableList],
    data() {
        return {
            // totals: 0,
            isMixin: true,
            Tools: {show: true},
            Tabs: {show: true},
            formData:{
                search:{
                }
            },
            Searchs: {
                show: true,
                labelWidth: 120,
            },
            Plugins: {show: true},
        }
    },
    methods: {
        ajaxRequest: HttpAMRechargeList,
        interceptRequest (params) {
            
            if (params.search.BT_createdAt&&params.search.BT_createdAt[0]!='') {
                params.search.BT_createdAt = this.handleDateFormat(params.search.BT_createdAt[0],'yyyy-mm-dd') + ' ~ ' + this.handleDateFormat(params.search.BT_createdAt[1],'yyyy-mm-dd')
            }
            if (params.search.BT_arrivalDate&&params.search.BT_arrivalDate[0]!='') {
                params.search.BT_arrivalDate = this.handleDateFormat(params.search.BT_arrivalDate[0],'yyyy-mm-dd') + ' ~ ' + this.handleDateFormat(params.search.BT_arrivalDate[1],'yyyy-mm-dd')
            }
            return params
        },
        handleOperates(params="", type,batch) {
            if(batch===true){
                params=(params||this.checkedData.join(','))+'';
                if(!params.length) return this.$Message.warning('请选择至少一条数据');
            }
            switch (type) {
                case 'recharge': {
                    this.$router.push({ name: 'recharge' })
                };
                break;
                case 'download': 
                    this.handleWebfs(
                        process.env.VUE_APP_APIURL_SHIP + "/api/jwt/spl/rechargerecord/export", this.formData,
                        "download"
                    );
                break;
                
            }
        },
    },
    computed: {
        ...mapGetters('dictionary', ['getSysAllList']),
        // 搜索下拉框展示内容
        SearchsData() {
            return  [
                {
                    label: '组织',
                    key: 'EQ_organizationId',
                    tag: 'Select',
                    options: this.getSysAllList,
                    props:{
                        filterable:true,
                    },
                    show: true,
                },
                {
                    label: '资金到账日期',
                    key: 'BT_arrivalDate',
                    tag: 'DatePicker',
                    // hideSearchTip:true,
                    show:true,
                    props: {
                        options:this.options,
                        type: 'daterange',
                        confirm: false,
                    },
                    style: 'width:200px'
                },

                {
                    label: '创建日期',
                    tag: 'DatePicker',
                    key: 'BT_createdAt',
                    // hideSearchTip:true,
                    show:true,
                    props: {
                        options:this.options,
                        type: 'daterange',
                        confirm: false,
                    },
                    style: 'width:200px'
                },
            ]
        },
        ToolsData(){
            return [
                {
                    name: "立即充值",
                    theme: 'primary',
                    operate: 'recharge',
                },
                {
                    name: "导出",
                    theme: 'success',
                    operate: 'download',
                },
            ]
        },
        // table的展示数据
        columns() {
            return [{
                title: "资金到账时间",
                key: "arrivalDate",
                sortable: true,
            }, {
                title: "账户组织",
                key: "organizationName",
            }, {
                title: "充值金额(USD)",
                key: "amount",
                sortable: true,
            }, {
                title: "账户可用余额(USD)",
                key: "availableAmountSnapshot",
                sortable: true,
            }, {
                title: "备注",
                key: "remark",
                sortable: true,
            }, {
                title: "创建人",
                key: "createdName",
            }, {
                title: "创建时间",
                key: "createdAt",
            },];
        },
        
    },

};
